import 'package:flutter/material.dart';

// 装饰
mixin JJModify {
  // Container本身的属性
  AlignmentGeometry? alignment;
  EdgeInsetsGeometry? padding;
  Color? color;
  Decoration? decoration;
  Decoration? foregroundDecoration;
  double? width;
  double? height;
  BoxConstraints? constraints;
  EdgeInsetsGeometry? margin;
  Matrix4? transform;
  AlignmentGeometry? transformAlignment;
  Clip clipBehavior = Clip.none;

  // true:不采用父类的约束
  bool unconstrainedBox = false;

  Widget modifyBuild(BuildContext context) {
    Widget view = Container(
      alignment: alignment,
      padding: padding,
      color: color,
      decoration: decoration,
      foregroundDecoration: foregroundDecoration,
      width: width,
      height: height,
      constraints: constraints,
      margin: margin,
      transform: transform,
      transformAlignment: transformAlignment,
      clipBehavior: clipBehavior,
      child: selfBuild(context),
    );

    if (unconstrainedBox) {
      view = UnconstrainedBox(
        child: view,
      );
    }

    return view;
  }

  Widget selfBuild(BuildContext context) {
    return Container();
  }
}
